<%@ page language="java" import="java.util.*"
	contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://www.rapid-framework.org.cn/rapid" prefix="rapid"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<rapid:override name="frame-header-style">
	<link rel="stylesheet" href="plugin/layui/css/layui.css">
	<link rel="stylesheet" href="css/back.css">
	<link rel="stylesheet"
		href="plugin/font-awesome/css/font-awesome.min.css">
	<style>
/*覆盖 layui*/
.layui-input-block {
	margin: 0px 10px;
}

.layui-table {
	margin-top: 0;
}

.layui-col-md4 {
	padding: 10px;
}

.layui-col-md8 {
	padding: 10px;
}

.layui-btn {
	margin: 2px 0 !important;
}
</style>
</rapid:override>
<rapid:override name="frame-header-script">
	<script src="static/js/jquery.min.js"></script>
	<script>

//用来检测分类名是否重复
function checkTagName() {
  var result=false;
  if($("#tagName").val()==null||$("#tagName").val()==""){
	  $("#tagName_msg").html("标签名不能为空！").css("color","red");
  }
  else{
  $.ajax({
      async: false,//同步，待请求完毕后再执行后面的代码
      type: "POST",
      url: 'tag/checkTagName',
      //contentType: "application/x-www-form-urlencoded; charset=utf-8",
      data: {"tagName": $("#tagName").val()},
      success: function (data) {
      	
          //用户名存在
          if(data==1) {
              $("#tagName_msg").html("标签名重复，请重新输入！").css("color","red");
              result=false;
          }
          //用户名不存在
          if(data==0) {
              $("#tagName_msg").html("标签名可用").css("color","green");
              result=true;
          }
      },
  })}
  return result;
}
function checkAll(){
	var result =checkTagName();
	return result;
}
</script>
</rapid:override>
<rapid:override name="frame-content">
	<div style="padding: 15px;">
		<blockquote class="layui-elem-quote">
			<span class="layui-breadcrumb" lay-separator="/"> <a
				href="/admin">首页</a> <a><cite>标签列表</cite></a>
			</span>
		</blockquote>
		<div class="layui-row">
			<div class="layui-col-md4">
				<form class="layui-form" method="post" id="myForm"
					action="tag/updateTag">
					<div class="layui-form-item">
						<div class="layui-input-block">
							<strong>修改标签</strong>
						</div>
						<input type="hidden" id="tagId" name="tagId" value="${tag.tagId}">
						<div class="layui-input-block">
							名称 <span style="color: #FF5722;">*</span> <input type="text" id="tagName"
								name="tagName" placeholder="请输入标签名称" onblur="checkTagName()" autocomplete="off"
								class="layui-input" required value="${tag.tagName}" >
								<label  id="tagName_msg"  ></label>
						</div>
						<br>
						<div class="layui-input-block">
							标签描述 <input type="text" name="tagDescription"
								placeholder="请输入标签描述" autocomplete="off" class="layui-input"
								value="${tag.tagDescription}">
						</div>
						<br>
						<div class="layui-input-block">
							<button class="layui-btn" lay-filter="formDemo" type="submit">修改</button>
							${msg }
						</div>
					</div>
				</form>
				<blockquote class="layui-elem-quote layui-quote-nm">
					温馨提示：
					<ul>
						<li>1、标签名必选，建议不要太长</li>
						<li>2、标签名勿重复</li>
					</ul>
				</blockquote>
			</div>
		</div>
	</div>
</rapid:override>

<%@ include file="../framework.jsp"%>